//package sunflower.config.security;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.http.HttpMethod;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//
///**
// * @description:
// * @author: TanJingyu
// * @create: 2021-09-29 18:26
// **/
//@EnableWebSecurity
//public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
//
//    @Value("${spring.security.oauth2.resourceserver.opaque.introspection-uri}")
//    String introspectionUri;
//
//    @Value("${spring.security.oauth2.resourceserver.opaque.introspection-client-id}")
//    String clientId;
//
//    @Value("${spring.security.oauth2.resourceserver.opaque.introspection-client-secret}")
//    String clientSecret;
//
//    @Override
//    protected void configure(HttpSecurity http) throws Exception {
//        // @formatter:off
//        http
//                .authorizeRequests((requests) -> requests
//                        .mvcMatchers(HttpMethod.GET, "/message/**").hasAuthority("SCOPE_message:read")
//                        .mvcMatchers(HttpMethod.POST, "/message/**").hasAuthority("SCOPE_message:write")
//                        .anyRequest().authenticated()
//                )
//                .oauth2ResourceServer((resourceServer) -> resourceServer
//                        .opaqueToken((opaqueToken) -> opaqueToken
//                                .introspectionUri(this.introspectionUri)
//                                .introspectionClientCredentials(this.clientId, this.clientSecret)
//                        )
//                );
//        // @formatter:on
//    }
//
//}
